Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/src/packages/next/pages/[owner]/[project].tsx
Views: 687
/*1* This file is part of CoCalc: Copyright © 2021 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45// Page for a project that is owned by a named account6// or organization.78import getProjectId from "lib/names/project";9import withCustomize from "lib/with-customize";10import getProjectInfo from "lib/project/info";11import getProject from "lib/share/get-project";12import Project from "components/project/project";13import Organization from "components/share/proxy/organization";14import getPublicPathInfoGithub from "lib/share/proxy/get-public-path-info-github";1516export default function Page(props) {17if (props.project_id) {18return <Project {...props} />;19} else {20// e.g., for listing all github repos in an org:21return <Organization {...props} />;22}23}2425export async function getServerSideProps(context) {26const { owner, project } = context.params;2728try {29let props;30if (owner == "github") {31// special case for special github URL's32// This is a URL like https://cocalc.com/github/cocalc,33// which will end up listing all public repos under the cocalc org (say).34props = {35...(await getPublicPathInfoGithub(`${owner}/${project}`)),36organization: project,37};38} else {39const project_id = await getProjectId(owner, project);40props = {41project_id,42...(await getProjectInfo(project_id, context.req)),43...(await getProject(project_id, [44"name",45"title",46"description",47"avatar_image_full",48])),49};50}51return await withCustomize({ context, props });52} catch (err) {53console.log(err);54return { notFound: true };55}56}575859